package com.kl.forum.api;


import com.kl.forum.service.SigInService;
import com.kl.forum.util.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api("签到")
@RestController
@RequestMapping("/sign")
public class SignInControllerAPI {

    @Autowired
    private SigInService sigInService;


    /**
     *  签到状态
     * @param userId
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "签到状态",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = false, dataType = "Long"),
    })
    @RequestMapping(value = "/signInStatus",method= RequestMethod.GET)
    public ResultInfo signInStatus(@RequestParam(value = "userId",required = false) Integer userId ){
        return sigInService.signInStatus(userId);
    }



    /**
     *  签到
     * @param userId
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "签到",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = true, dataType = "Long"),
    })
    @RequestMapping(value = "/signIn",method= RequestMethod.POST)
    public ResultInfo signIn(@RequestParam(value = "userId",required = false) Integer userId){
        return sigInService.signIn(userId);
    }



    /**
     *  签到页面
     * @param userId
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "签到页面",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = false, dataType = "Long"),
    })
    @RequestMapping(value = "/signInPage",method= RequestMethod.GET)
    public ResultInfo signInPage(@RequestParam(value = "userId",required = false) Integer userId ){
        return sigInService.signInPage(userId);
    }

    /**
     *  用户信息
     * @param userId
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "用户信息",notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户Id", required = true, dataType = "Long"),
    })
    @RequestMapping(value = "/findUser",method= RequestMethod.GET)
    public ResultInfo findUser(@RequestParam(value = "userId",required = true) Integer userId ){
        return sigInService.findUser(userId);
    }

}
